import java.util.Scanner;


public class text_8 {
    //获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n =scanner.nextInt();
        for (int i = 0; i < 32; i+=2) {
            //从右到左
            System.out.printf(((n>>i)&1)+ " ");
            }
        System.out.println();
        //从左到右
        for (int i = 30; i >=0; i-=2) {
            System.out.printf(((n>>i)&1)+" ");
        }
        }

     
    //编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，提示“登录成功”,
    // 密码错误， 可以重新输 入，
    // 最多输入三次。三次均错，则提示退出程序

    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String code = "123456";
        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入密码");
            String code1 = scanner.nextLine();
            if(code.equals(code1)){
                System.out.println("登录成功");
                break;
            } else if (3-i==0) {
                System.out.println("退出程序");
            } else{
                System.out.println("密码错误，请重新输入，还剩下"+(3-i)+"次机会");
            }
        }
    }
    //输出一个整数的每一位，如：123的每一位是3，2，1
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int stmp = n;
        while (stmp != 0) {
            int i = stmp % 10;
            stmp = stmp / 10;
            System.out.println(i);
        }
    }

    /*输入：5
输出：
        *   *
         * *
          *
         * *
        *   **/
    public static void main1(String[] args) {

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (i == j || i + j == n - 1) {
                        System.out.printf("*");
                    } else {
                        System.out.printf(" ");
                    }
                }
                System.out.println();
            }
            System.out.println("================================");
        }
    }
}